package cn.biao.epic.sys.modular.system.mapper;

import cn.biao.epic.sys.modular.system.entity.Menu;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @Auther Uncle_Z
 * @date 2019/12/6 14:02
 * @Email:2545375@qq.com
 * @Descrition
 */
public interface MenuMapper extends BaseMapper<Menu> {

    /**
     * 
     * 根据条件查询菜单
     *
     * @author uncle_z
     * @Date 2019/12/6 14:07
     * @Param [page, condition, level, menuId, code]
     * @File MenuMapper.java 
     */
    Page<Map<String,Object>> selectMenus(@Param("page") Page page,
                                         @Param("condition") String condition,
                                         @Param("level") String level,
                                         @Param("menuId") Long menuId,
                                         @Param("code") String code);

    /**
     *
     * 根据条件查询菜单ID
     *
     * @author uncle_z
     * @Date 2019/12/6 14:08
     * @Param [roleId]
     * @File MenuMapper.java
     */
    List<Long> getMenuIdsByRoleId(@Param("roleId") Long roleId);

    /**
     * 
     * 删除角色菜单的关联
     *
     * @author uncle_z
     * @Date 2019/12/6 14:11
     * @Param [menuId]
     * @File MenuMapper.java 
     */
    int deleteRelationByMenu(@Param("menuId")Long menuId);

    /**
     *
     * 通过角色获取菜单urls
     *
     * @author uncle_z
     * @Date 2019/12/6 14:12
     * @Param [roleId]
     * @File MenuMapper.java
     */
    List<String> selectUrlsByRoleId(@Param("roleId") Long roleId);


    /**
     * 
     * 通过角色获取菜单类型
     *
     * @author uncle_z
     * @Date 2019/12/6 14:23
     * @Param [roleIds]
     * @File MenuMapper.java 
     */
    List<String> getMenusTypesByRoleIds(List<Long> roleIds);

    /**
     * 
     * 获取菜单树形列表
     *
     * @author uncle_z
     * @Date 2019/12/6 14:24
     * @Param [condition, level]
     * @File MenuMapper.java 
     */
    List<Map<String,Object>> selectMenuTree(@Param("condition") String condition, @Param("level") String level);

    /**
     * 
     * 获取pcodes like某个code的菜单列表
     *
     * @author uncle_z
     * @Date 2019/12/6 14:26
     * @Param [code]
     * @File MenuMapper.java 
     */
    List<Menu> selectMenulikePcodes(@Param("code") String code);
}
